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 Factory
interface ISunswapFactory {
event NewExchange(address indexed token, address indexed exchange);
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);
}
3 Exchange
interface ISunswapExchange {
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
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);
function addLiquidity(uint256 min_liquidity, uint256 max_tokens, uint256 deadline)
external payable returns (uint256);
function removeLiquidity(uint256 amount, uint256 min_trx, uint256 min_tokens, uint256
deadline) external returns (uint256, uint256);
}