Rebase-able ICRC1 token

Hi, we are currently wrapping ICRC-1 to add rebase-able feature

currently we are adjusting “balance_of” function based on the ICRC-1 repo (ICRC-1/ref/ICRC1.mo at main · dfinity/ICRC-1 · GitHub)

balance_of(PID) = shares[PID] * totalPooledCKBTC / totalShares
with shares = how much BTC initially invested by the user

we are going to build it manually on local and they deploy this custom ICRC-1.
my question is, what is the best approach to do this? or are we already on the right track?
or is there any other recommended way? (i didnt find any other way hence the question)

2 Likes

How would you then manage the total supply with icrc1_total_supply without actually burning the tokens?

1 Like

there is another function to rebase the supply every certain period (24 hours in our case), could be burn or mint

1 Like

You may have more success extending GitHub - PanIndustrial-Org/ICRC_fungible: A full implementation of an ICRC 1,2,3 compatible fungible token as it is specifically set up to do whiz-bang things like you are attempting. You’ll also get ICRC 3 and 4. I’ll be happy to help you out however I can. In this instance, instead of calling the await ICRC.balance_of function you can write your own return function. The referenced icrc1.mo library will also give you good handles to write a mint/burn timer process to adjust your supply.

I walk through the whole library and set up here: https://www.youtube.com/playlist?list=PLuQrY06IeLwNUgGbGdH9rggewQnaaQHjR

1 Like