文章
问答
讲堂
百科图谱
线下集训
更多
提问
发表文章
专栏
活动
文档
工作
集市
发现
Toggle navigation
文章
问答
讲堂
线下集训
专栏
活动
工作
文档
集市
搜索
登录/注册
15
bsc, heco类ETH链上如何通过web3.js获得一个代币交易对的兑换价格
bsc, heco类ETH链上如何通过web3.js获得一个代币交易对的兑换价格
bsc, heco类ETH链上如何通过web3.js获得一个代币交易对的兑换价格
0 条评论
请先
登录
后评论
最佳答案
2021-10-25 15:19
获取两个交易对的储备量: `getReserves`
获取两个交易对的储备量:
getReserves
0 条评论
0
请先
登录
后评论
Tiny熊
擅长:智能合约,以太坊 | 采纳率 33% | 回答于 2021-10-24 09:11
默认排序
时间排序
其它 2 个回答
Tiny熊
2021-10-22 17:12
擅长:智能合约,以太坊
这个需要用 web3 去调用 panckage 或者 mdex 合约, 查看对应LP流动池来获取价格。
请先
登录
后评论
carvin
2021-10-22 17:19
您好,能再具体一点吗,比如这个是pancake factory合约的部分代码,是从这里面找吗? ``` interface IPancakeFactory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IPancakePair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } ```
请先
登录
后评论
您需要登录后才可以回答问题,
登录
关注
2
关注
收藏
0
收藏,
3557
浏览
carvin
提出于 2021-10-22 16:29
×
发送私信
请将文档链接发给晓娜,我们会尽快安排上架,感谢您的推荐!
发给:
内容:
×
举报此文章
垃圾广告信息:
广告、推广、测试等内容
违规内容:
色情、暴力、血腥、敏感信息等内容
不友善内容:
人身攻击、挑衅辱骂、恶意行为
其他原因:
请补充说明
举报原因: