convert_mellow_price_d18_to_share_price

Documentation for eth_defi.mellow.vault.convert_mellow_price_d18_to_share_price function.

convert_mellow_price_d18_to_share_price(price_d18, share_token_decimals, asset_decimals)

Convert Mellow priceD18 to denomination-token assets per share.

Mellow Core Vault reports use raw-token accounting: raw_shares = raw_assets * priceD18 / 1e18. Our historical vault price convention is human-readable denomination-token assets per one human-readable share token.

Parameters
  • price_d18 (int) – Raw Mellow oracle priceD18 integer.

  • share_token_decimals (int) – ERC-20 decimals of the tokenised ShareManager.

  • asset_decimals (int) – ERC-20 decimals of the denomination asset in the report.

Returns

Human-readable asset amount per one human-readable share, or None for a zero oracle price.

Return type

Optional[decimal.Decimal]