Skip to content

Commit

Permalink
ui: fix grown stalk calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalecks committed Apr 11, 2024
1 parent 81a21a3 commit 8ca61e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion projects/sdk/src/lib/silo/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ export function calculateGrownStalkSeeds(
* @param bdv The bdv of the deposit
*/
export function calculateGrownStalkStems(stemTip: ethers.BigNumber, stem: ethers.BigNumber, bdv: TokenValue) {
const deltaStem = stemTip.sub(stem);
let deltaStem = stemTip.sub(stem);
// If we have migrated stems, we need to divide by 10e6
if (stem.gt(10 ** 6)) {
deltaStem = deltaStem.div(10 ** 6);
}
if (deltaStem.lt(0)) return Silo.sdk.tokens.STALK.fromHuman("0"); // FIXME
return Silo.sdk.tokens.STALK.fromBlockchain(bdv.toBigNumber().mul(deltaStem));
}
Expand Down

0 comments on commit 8ca61e0

Please sign in to comment.