Closed ethanfrey closed 2 years ago
So this method would produce zero or two CosmosMsg
s? One to trigger BToken increase, one to trigger LToken increase? Or was there something else you had in mind with the Vec<CosmosMsg>
?
So this method would produce zero or two
CosmosMsg
s? One to trigger BToken increase, one to trigger LToken increase? Or was there something else you had in mind with theVec<CosmosMsg>
?
That is a correct understanding. I had nothing else in mind
This requires #31 which is not yet merged. The logic is implemented but not yet tested.
Please either wait for that to merge, or base on top of that branch.
I'm aware, I've created branch on top of his.
We need to define a
charge_interest
method which is invoked by many other methods before performing other actions. Basically, it may return aVec<CosmosMsg>
, which we need to prepend on other actions. There may well be some issues of message ordering that come up (I assume this to be non-trivial), but I will define the basic behaviour:More technically,
last_charged
on creation to beenv.block.time.seconds() - env.block.time.seconds() % epoch_length
. This is storedepochs_passed
as(env.block.time.seconds() - last_charged) / epoch_length
.epochs_passed
is 0, we do nothinglast_charged += epochs_passed * epoch_length
ratio = calculate_interest() * epochs_passed * epoch_length / 31.556.736
.ExecuteMsg::Rebase{ratio}
on B-Tokenl_ratio = b_supply() * ratio / l_supply()
. ThenExecuteMsg::Rebase{ratio: l_ratio}
on L-TokenPlease bring up any questions... The actual deposit/withdraw etc are defined in base assets and will be adjusted by the new multiplier automatically if they are returned after the other messages from charge_interest