Stablecoinswap API
Contract is written in Vyper (0.1.0b9)
addLiquidity
Adding liquidity is free. However, removing liquidity bears the same fee as the swap operation. This is to prevent users from bypassing the trading fee by depositing liquidity in one token and instantly withdrawing it in another token.
Parameter | Type | Description |
token_address | address | Address of ERC20 token to add |
erc20_token_amount | uint256 | How many ERC20 tokens to add |
deadline | uint256 | Transaction deadline |
Returns | |
uint256 | The amount of STL tokens received by the sender. |
removeLiquidity
Parameter | Type | Description |
token_address | address | Address of ERC20 token to remove |
stableswap_token_amount | uint256 | Amount of STL tokens to redeem |
erc20_min_output_amount | uint256 | Minimum ERC20 tokens output amount |
deadline | uint256 | Transaction deadline |
Returns | |
uint256 | The amount of erc20 tokens received by the sender. |
swapTokens
Parameter | Type | Description |
input_token | address | Address of input ERC20 token |
output_token | address | Address of output ERC20 token |
erc20_input_amount | uint256 | Amount of ERC20 input tokens sold |
erc20_min_output_amount | uint256 | Minimum ERC20 output tokens to buy |
deadline | uint256 | Transaction deadline |
Returns | |
uint256 | The amount of erc20 tokens received by the sender. |
tokenExchangeRateAfterFees
Parameter | Type | Description |
input_token_address | address | Address of ERC20 token to sell |
output_token_address | address | Address of ERC20 token to buy |
Returns | |
uint265 | Exchange rate multiplied by 10^22. Note that due to rounding, the fees could be slightly higher for the tokens with smaller decimal precision and/or if the exchange amount is too low. |
tokenOutputAmountAfterFees
Parameter | Type | Description |
input_token_amount | uint256 | Amount of ERC20 token to sell |
input_token_address | address | Address of ERC20 token to sell |
output_token_address | address | Address of ERC20 token to buy |
Returns | |
uint256 | How many tokens can be bought for a given amount of input tokens |
poolOwnership
Parameter | Type | Description |
user_address | address | Address of a user |
Returns | |
fixed168x10 (uint168) | Share of total liquidity belonging to the user |
fees
Parameter | Type | Description |
fee_name | string | 'ownerFee' or 'tradeFee' |
Returns | |
fixed168x10 (uint168) | Fee value (i.e. 0.001 means 0.1%) |
inputTokens
Parameter | Type | Description |
address | address | Address of ERC20 token |
Returns | |
bool | True if an address is in the list of available input tokens |
outputTokens
Parameter | Type | Description |
address | address | Address of ERC20 token |
Returns | |
bool | True if an address is in the list of available output tokens |
priceOracleAddress
Returns | |
address | Address of a priceoracle contract |
Last updated