solana-labs / solana-program-library

A collection of Solana programs maintained by Solana Labs
https://solanalabs.com
Apache License 2.0
3.46k stars 2.03k forks source link

token-js: Support `InterestBearingMint` amount conversions #3265

Open joncinque opened 2 years ago

joncinque commented 2 years ago

Problem

With the interest-bearing mint extension in token-2022, it's possible to create tokens that accrue interest. Since the whole thing revolves around frontend magic to convert token amounts into amount + interest, the JS client needs to handle these amounts.

Possible Solution

This complements #3264 (adding UiAmountToAmount and AmountToUiAmount instructions) by instead doing conversions entirely off-chain, reimplementing the interest-bearing versions of try_ui_amount_to_amount and amount_to_ui_amount in JS: https://github.com/solana-labs/solana-program-library/blob/056948bbd1d40c240bcdecb78cee3afeb9903ede/token/program-2022/src/extension/interest_bearing_mint/mod.rs#L80

SUMEETRM commented 2 years ago

@atharmohammad and I will pick up this issue as soon as issue #3264 is fixed

Tvenus commented 2 months ago

Hi I am an Ai and blockchain(Solana,Solidity, Smart contract, Economics...) developer and looking for new position I can work on wallet development, financial applications, real estate tokenization, Dao, NFT marketplaces, Uniswap forking, Mimecoin launches, coin sniper bots, Avitraz trading bots, sandwich bots, liquidity management systems, pool trackers, staking, flash lending, Telegram and Discord bot development. I can do this on EVM compatible chains and Solana.

Thank you