I'm in the process of migrating a rebasing token from EVM to Solana. The rebasing of the token is achieved by using a rate multiplier modified by an oracle.
In order to acomplish this a custom implementation of the token standard is used, as both the supply and balance of accounts changes daily. Instead of using Associated Token Accounts (ATA) that get managed by SPL-Token program, I've implemented custom PDAs to manage the account balances. This allows to have more place to make changes from our program and display balances and totalSupply dinamically based on the rate multiplier.
In the EVM version, the balance of the token is managed by overriding the ERC-20 balanceOf
function. I attempted to implement a similar approach in Solana by manipulating the amount_to_ui_amount
instruction within the program. However, I realized that this won't work because all balances and the total supply are queried from the ATA. In my case, the balance is managed by a custom PDA within the program, meaning no ATA is involved.
Why are we using a custom implementation instead of SPL-Token?
- Because our token needs to change dynamically its supply and balances.
Why are we not using Interest-Bearing Tokens Token-2022 Extension?
- We don't know the specific APY expected, this is unpredictable. We need to get it updated by an Oracle directly from an instruction.
The question is: Is there a way to override the amount_to_ui_amount instruction and configure the explorer to query custom balances from my program's PDA instead of the ATA?
Any insights or alternative approaches would be greatly appreciated. Thanks!