Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!
当前位置: 主页 > Java文档 > Java基础相关 >

justswap中文文档 PDF 下载


分享到:
时间:2021-03-06 10:37来源:http://www.java1234.com 作者:转载  侵权举报
justswap中文文档 PDF 下载
失效链接处理
justswap中文文档 PDF 下载


本站整理下载:
提取码:kxmr 
 
 
相关截图:
 
主要内容:


一、后端API 1.1 获取所有交易对接口
GET: https://api.justswap.io/v2/allpairs
参数: page_size : int, 每个分页大小, 最大值 50 page_num: int, 第几个分页, 从0 开始 返回值格式: {
 "data":
 [{
 "0_TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t": {//key:TRX的id和token的id
 "quote_id": "0", // 0表示TRX的id
 "quote_name": "TRX", // 目前只支持TRX的名称
 "quote_symbol": "TRX", // 目前只支持TRX的简称
 "quote_decimal": "6", // TRX的精度为6
 "base_id": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", // token的contract
address
 "base_name": "Tether USD", // base_token的名称, 这里是 USDT
 "base_symbol": "USDT", // token的简称
 "base_decimal": "6", // token的精度
 "price": "37.450887374011593590", // 当前 base_token 的价格, 当前是 1 USDT
= 37.45 TRX
 "quote_volume": "16928742252878", // 最近24小时累计交易 TRX 的数量, 单位:
1 SUN
 "base_volume": "452025130508" // 最近24小时累计交易 base_token 的数量, 单
位是其最小单位
 }],
 "total_num": 25, // 总条目数
 "err_no":0,
 "err_msg":""
}备注: 该接口单访问来源的最大访问频率为 1次 / second 3
二、智能合约接口 2.1 合约地址 合约名称 合约地址 备注 factory合约 TXk8rQSAvPvBBNtqSoY6nCfsXWCSSpTVQF factory 合约负责创建交 易对, 和维护交易对列表 exchange 合约 TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE 每种交易对有一个 exchange 合约. 这个是 USDT/TRX 的exchange 合约地址. 2.2 合约接口列表 2.2.1 TRC20 Token interface ITRC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }2.2.2 Factory interface IJustswapFactory { event NewExchange(address indexed token, address indexed exchange); 4
function initializeFactory(address template) external; function createExchange(address token) external returns (address payable); function getExchange(address token) external view returns (address payable); function getToken(address token) external view returns (address); function getTokenWihId(uint256 token_id) external view returns (address); }2.2.3 Exchange interface IJustswapExchange { event TokenPurchase(address indexed buyer, uint256 indexed trx_sold, uint256 indexed tokens_bought); event TrxPurchase(address indexed buyer, uint256 indexed tokens_sold, uint256 indexed trx_bought); event AddLiquidity(address indexed provider, uint256 indexed trx_amount, uint256 indexed token_amount); event RemoveLiquidity(address indexed provider, uint256 indexed trx_amount, uint256 indexed token_amount); function () external payable; function getInputPrice(uint256 input_amount, uint256 input_reserve, uint256 output_reserve) external view returns (uint256); function getOutputPrice(uint256 output_amount, uint256 input_reserve, uint256 output_reserve) external view returns (uint256); function trxToTokenSwapInput(uint256 min_tokens, uint256 deadline) external payable returns (uint256); function trxToTokenTransferInput(uint256 min_tokens, uint256 deadline, address recipient) external payable returns(uint256); function trxToTokenSwapOutput(uint256 tokens_bought, uint256 deadline) external payable returns(uint256); function trxToTokenTransferOutput(uint256 tokens_bought, uint256 deadline, address recipient) external payable returns (uint256); function tokenToTrxSwapInput(uint256 tokens_sold, uint256 min_trx, uint256 deadline) external returns (uint256); function tokenToTrxTransferInput(uint256 tokens_sold, uint256 min_trx, uint256 5
deadline, address recipient) external returns (uint256); function tokenToTrxSwapOutput(uint256 trx_bought, uint256 max_tokens, uint256 deadline) external returns (uint256); function tokenToTrxTransferOutput(uint256 trx_bought, uint256 max_tokens, uint256 deadline, address recipient) external returns (uint256); function tokenToTokenSwapInput(uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_trx_bought, uint256 deadline, address token_addr) external returns (uint256); function tokenToTokenTransferInput(uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_trx_bought, uint256 deadline, address recipient, address token_addr) external returns (uint256); function tokenToTokenSwapOutput(uint256 tokens_bought, uint256 max_tokens_sold, uint256 max_trx_sold, uint256 deadline, address token_addr) external returns (uint256); function tokenToTokenTransferOutput(uint256 tokens_bought, uint256 max_tokens_sold, uint256 max_trx_sold, uint256 deadline, address recipient, address token_addr) external returns (uint256); function tokenToExchangeSwapInput(uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_trx_bought, uint256 deadline, address exchange_addr) external returns (uint256); function tokenToExchangeTransferInput(uint256 tokens_sold, uint256 min_tokens_bought, uint256 min_trx_bought, uint256 deadline, address recipient, address exchange_addr) external returns (uint256); function tokenToExchangeSwapOutput(uint256 tokens_bought, uint256 max_tokens_sold, uint256 max_trx_sold, uint256 deadline, address exchange_addr) external returns (uint256); function tokenToExchangeTransferOutput(uint256 tokens_bought, uint256 max_tokens_sold, uint256 max_trx_sold, uint256 deadline, address recipient, address exchange_addr) external returns (uint256); function getTrxToTokenInputPrice(uint256 trx_sold) external view returns (uint256); function getTrxToTokenOutputPrice(uint256 tokens_bought) external view returns (uint256); function getTokenToTrxInputPrice(uint256 tokens_sold) external view returns (uint256); function getTokenToTrxOutputPrice(uint256 trx_bought) external view returns (uint256); function tokenAddress() external view returns (address); function factoryAddress() external view returns (address);

 

------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐