UNPKG

@exromany/lido-csm-sdk

Version:

[![GitHub license](https://img.shields.io/github/license/lidofinance/lido-csm-sdk?color=limegreen)](https://github.com/lidofinance/lido-csm-sdk/blob/main/LICENSE.txt) [![Version npm](https://img.shields.io/npm/v/@lidofinance/lido-csm-sdk?label=version)](h

16 lines 644 B
const PRECISION = 10n ** 27n; /** * Converts stETH shares to ETH amount using the current pool ratio. * Also works for converting wstETH to stETH. */ export const convertSharesToEth = (shares, { totalPooledEther, totalShares }) => { return (shares * totalPooledEther * PRECISION) / (totalShares * PRECISION); }; /** * Converts ETH amount to stETH shares using the current pool ratio. * Also works for converting stETH to wstETH. */ export const convertEthToShares = (eth, { totalPooledEther, totalShares }) => { return (eth * totalShares * PRECISION) / (totalPooledEther * PRECISION); }; //# sourceMappingURL=convert-shares.js.map