StablecoinSwap
  • Getting started
  • SMART CONTRACT API
    • Stablecoinswap API
    • Priceoracle API
Powered by GitBook
On this page
  • poolSize
  • supportedTokens
  • normalized_token_prices

Was this helpful?

  1. SMART CONTRACT API

Priceoracle API

Contract is written in Vyper (0.1.0b9)

poolSize

@constant
def poolSize(contract_address: address) -> uint256
contract.methods.poolSize(stablecoinswap_address).call()

Parameter

Type

Description

contract_address

address

Address of a stablecoinswap contract

Returns

uint256

Total pool size of stablecoinswap contract in USD multiplied by 10**18

supportedTokens

supportedTokens: public(address[5])
contract.methods.supported_tokens(index).call()

Parameter

Type

Description

index

uint

Index of a supported token (0 to 4)

Returns

address

Address of ERC20 token

normalized_token_prices

normalized_token_prices: public(map(address, uint256))
contract.methods.normalized_token_prices(token_address).call()

Parameter

Type

Description

address

address

Address of ERC20 token contract

Returns

uint256

Returns normalized price in USD for a token at given address.

Where:

normalized_usd_price = usd_price * 10**8 * 10**(18 - token.decimals)

Example: USD price for USDC = $1.0, token has 6 decimals:

normalized_usd_price = 100000000000000000000

PreviousStablecoinswap API

Last updated 5 years ago

Was this helpful?

USD price for DAI token is the price according to and USD price for any other token is always $1.0

https://etherscan.io/address/0x787f552bdc17332c98aa360748884513e3cb401a