How to calculate the value of supplyDelta in a rebase contract

I want to calculate a supplyDelta value to be used in a rebase function for this contract But I don't know how to calculate it. Any help will be really appreciated. I had a look at this article but couldn't understand it without an example

1 Like

New Trenddddd right?

At the moment I looked at some rebase contracts, and I suggest to look at the main and only real one You can learn a lot from their docs.

The rebase() function is usually called by an external contract, usually named Master, that is linked to a third contract, an Oracle. Thanks to the data given by the Oracle, the master do the math and call the rebase() with the """right""" input. Why so many """ ? Well because all the rebase tokens that has been launched in these days, are all made of ovverideRebase :stuck_out_tongue_winking_eye:

You can see an example here:

 function computeSupplyDelta(uint256 rate)
        returns (int256)
        if (withinDeviationThreshold(rate)) {
            return 0;

        int256 targetRateSigned = targetRate.toInt256Safe();
        return guh.totalSupply().toInt256Safe()
1 Like