@exromany/lido-csm-sdk
Version:
[](https://github.com/lidofinance/lido-csm-sdk/blob/main/LICENSE.txt) [](h
16 lines • 644 B
JavaScript
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